/**
 * Author: Shen Yanqiu
 * Date: 2017-12-06
 * Time: 16:58
 *
 */
import React from 'react';
import { connect } from "dva";
import PropTypes from 'prop-types';
import { Page } from 'components';
import queryString from "query-string";
import  Details from './Subpage/Details';
import { routerRedux } from 'dva/router';

class expenditureDetails extends React.Component {
  static PropTypes = {
    loading: PropTypes.object,
    dispatch: PropTypes.func,
    expenditure: PropTypes.object,
    location: PropTypes.object,
    detailsInfo: PropTypes.object,
  };
  componentWillMount () {
    const { match, dispatch } = this.props;
    const id = match.params.id;
    // console.log(match.params.id);
    dispatch({
      type: 'expenditure/refreshDetails',
      payload: { id },
    });
  }
  render () {
    const { loading, location, expenditure, dispatch, match } = this.props;
    // const detailsId = match.params.id;
    const { detailsInfo } = expenditure;
    // console.log(detailsInfo);
    return (
      <Page loading={loading.models.expenditure}>
        <Details {...detailsInfo} />
      </Page>
    );
  }
}

export default connect(({ loading, expenditure }) => ({ loading, expenditure }))(expenditureDetails);
